using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Finance.Web.Models.Mapping
{
    public class UserMap : EntityTypeConfiguration<User>
    {
        public UserMap()
        {
            // Primary Key
            this.HasKey(t => t.Code);

            // Properties
            this.Property(t => t.FName)
                .HasMaxLength(256);

            this.Property(t => t.LName)
                .HasMaxLength(256);

            this.Property(t => t.Password)
                .HasMaxLength(256);

            this.Property(t => t.Login)
                .HasMaxLength(256);

            // Table & Column Mappings
            this.ToTable("USER");
            this.Property(t => t.Code).HasColumnName("USERCODE");
            this.Property(t => t.FName).HasColumnName("FNAME");
            this.Property(t => t.LName).HasColumnName("LNAME");
            this.Property(t => t.Password).HasColumnName("PASSWORD");
            this.Property(t => t.Login).HasColumnName("LOGIN");
        }
    }
}
